package answer.modules.web;


import answer.common.base.MyBaseController;
import answer.modules.model.Users;
import answer.modules.service.IUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author CBY
 * @since 2019-01-04
 */
@Controller
@RequestMapping("/users")
public class UsersController extends MyBaseController {
	@Autowired
    private IUsersService usersService;

    @ResponseBody//****json格式
	@RequestMapping(value = "userList",method = RequestMethod.GET)
    public Object userList(){
        List<Users> list = null;
        try {
            list  = usersService.selectAllUser();
            for(Users u:list){
                System.out.println(u.getUser());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return renderSuccess(list);
    }
}
